/**
 */
package de.nordakademie.hausarbeit.stylesheet.impl;

import de.nordakademie.hausarbeit.stylesheet.Color;
import de.nordakademie.hausarbeit.stylesheet.Font;
import de.nordakademie.hausarbeit.stylesheet.Rule;
import de.nordakademie.hausarbeit.stylesheet.Stylesheet;
import de.nordakademie.hausarbeit.stylesheet.StylesheetPackage;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Stylesheet</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.nordakademie.hausarbeit.stylesheet.impl.StylesheetImpl#getColor <em>Color</em>}</li>
 *   <li>{@link de.nordakademie.hausarbeit.stylesheet.impl.StylesheetImpl#getFont <em>Font</em>}</li>
 *   <li>{@link de.nordakademie.hausarbeit.stylesheet.impl.StylesheetImpl#getRules <em>Rules</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class StylesheetImpl extends MinimalEObjectImpl.Container implements Stylesheet
{
  /**
   * The cached value of the '{@link #getColor() <em>Color</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getColor()
   * @generated
   * @ordered
   */
  protected EList<Color> color;

  /**
   * The cached value of the '{@link #getFont() <em>Font</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getFont()
   * @generated
   * @ordered
   */
  protected EList<Font> font;

  /**
   * The cached value of the '{@link #getRules() <em>Rules</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRules()
   * @generated
   * @ordered
   */
  protected EList<Rule> rules;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected StylesheetImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return StylesheetPackage.Literals.STYLESHEET;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Color> getColor()
  {
    if (color == null)
    {
      color = new EObjectContainmentEList<Color>(Color.class, this, StylesheetPackage.STYLESHEET__COLOR);
    }
    return color;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Font> getFont()
  {
    if (font == null)
    {
      font = new EObjectContainmentEList<Font>(Font.class, this, StylesheetPackage.STYLESHEET__FONT);
    }
    return font;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Rule> getRules()
  {
    if (rules == null)
    {
      rules = new EObjectContainmentEList<Rule>(Rule.class, this, StylesheetPackage.STYLESHEET__RULES);
    }
    return rules;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case StylesheetPackage.STYLESHEET__COLOR:
        return ((InternalEList<?>)getColor()).basicRemove(otherEnd, msgs);
      case StylesheetPackage.STYLESHEET__FONT:
        return ((InternalEList<?>)getFont()).basicRemove(otherEnd, msgs);
      case StylesheetPackage.STYLESHEET__RULES:
        return ((InternalEList<?>)getRules()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case StylesheetPackage.STYLESHEET__COLOR:
        return getColor();
      case StylesheetPackage.STYLESHEET__FONT:
        return getFont();
      case StylesheetPackage.STYLESHEET__RULES:
        return getRules();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case StylesheetPackage.STYLESHEET__COLOR:
        getColor().clear();
        getColor().addAll((Collection<? extends Color>)newValue);
        return;
      case StylesheetPackage.STYLESHEET__FONT:
        getFont().clear();
        getFont().addAll((Collection<? extends Font>)newValue);
        return;
      case StylesheetPackage.STYLESHEET__RULES:
        getRules().clear();
        getRules().addAll((Collection<? extends Rule>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case StylesheetPackage.STYLESHEET__COLOR:
        getColor().clear();
        return;
      case StylesheetPackage.STYLESHEET__FONT:
        getFont().clear();
        return;
      case StylesheetPackage.STYLESHEET__RULES:
        getRules().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case StylesheetPackage.STYLESHEET__COLOR:
        return color != null && !color.isEmpty();
      case StylesheetPackage.STYLESHEET__FONT:
        return font != null && !font.isEmpty();
      case StylesheetPackage.STYLESHEET__RULES:
        return rules != null && !rules.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //StylesheetImpl
